<%= render :partial => "jquery_mask" %>

<h1> Editing Profile: <%= "#{@user.person.name}" %> </h1>

<% form_for @user, users_path do |f| %>
  <%= f.error_messages %>

  <% f.fields_for :person do |person_form| %>
    <h3> Personal Information </h3>
    <p>
      <%= person_form.label :name %> <br />
      <%= person_form.text_field :name %>
    </p>
    <p>
      <%= person_form.label :phone %> <br />
      <%= person_form.text_field :phone, :class => "phone_input" %>
    </p>
  <% end %>
  <h3> User Information </h3>
  <p>
    <%= f.label :email %> <br />
    <%= f.text_field :email %>
  </p>
  <p>
    <%= f.label :password %> <br />
    <%= f.password_field :password %>
  </p>
  <p>
    <%= f.label :password_confirmation %> <br />
    <%= f.password_field :password_confirmation %>
  </p>
  <% if current_user.person.is_keyholder? %>
    <% f.fields_for :person do |p_form| %>
      <h3>Roles</h3>
      <div id="edit_user_roles">
        <p>
          <%= p_form.check_box :is_volunteer  %>
          <%= image_tag("/images/icons/roles/16-volunteer.png") %>
          <%= p_form.label :is_volunteer, "Volunteer" %>
        </p>
        <p>
          <%= p_form.check_box :is_keyholder  %>
          <%= image_tag("/images/icons/roles/16-keyholder.png") %>
          <%= p_form.label :is_keyholder, "Keyholder" %>
        </p>
        <p>
          <%= p_form.check_box :is_boardmember  %>
          <%= image_tag("/images/icons/roles/16-boardmember.png") %>
          <%= p_form.label :is_boardmember, "Boardmember" %>
        </p>
        <p>
          <%= p_form.check_box :is_active  %>
          <%= image_tag("/images/icons/png-8/16-circle-green-check.png") %>
          <%= p_form.label :is_active, "Active" %>
        </p>
      </div>
    <% end %>
  <% end %>
  <p>
    <%= f.submit "Save" %>
  </p>

<%  end %>